<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class SmsEvent
{

    use Dispatchable,
        InteractsWithSockets,
        SerializesModels;

    /**
     * 发送短信模块ID(第三方模板)
     * @var string 
     */
    public $templateId;

    /**
     * 用户ID(多个)
     * @var array 
     */
    public $userIds;

    /**
     * 短信变量信息
     * @var array
     */
    public $payload;

    /**
     * 任务ID
     * @var integer
     */
    public $taskId;

    /**
     * 短信类型
     * @var integer
     */
    public $type;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct($templateId, $userIds, $payload, $taskId, $type = 0)
    {
        $this->templateId = $templateId;
        $this->userIds = $userIds;
        $this->payload = $payload;
        $this->taskId = $taskId;
        $this->type = $type;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
//        return new PrivateChannel('channel-name');
    }

}
